<!DOCTYPE html>
<html lang="zh-CN">
  <head>
	  <%layout("/WEB-INF/view/common/inc/admin_head.html",{title:'添加用户', styles:'bootstrap,font-awesome,animate,style,dtvalidate,awesome-checkbox'}){%>
	  <style type="text/css">
		  body{padding-top:10px;}
	  </style>
	  <%}%>
  </head>
  <body>
	<!-- START 内容部分 -->
	<div class="container">
		<form class="form-horizontal" id="info-form" method="post">
			<input type="hidden" name="groupId" value="${groupid}"/>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">登录账号</label>
				<div class="col-sm-6">
					<input type="text" id="userAccount" name="userAccount" class="form-control" valid="r" validTitle="用户账号" validInfoArea="userAccount_info_area" />
				</div>
				<div class="col-sm-4"><p class="help-block" id="userAccount_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">登录密码</label>
				<div class="col-sm-6">
					<input type="password" id="userPassword" name="userPassword" class="form-control" valid="r" validTitle="用户登录密码" validInfoArea="userPassword_info_area" />
				</div>
				<div class="col-sm-4"><p class="help-block" id="userPassword_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">用户昵称</label>
				<div class="col-sm-6">
					<input type="text" id="userNickname" name="userNickname" class="form-control" valid="r" validTitle="用户昵称" validInfoArea="userNickname_info_area" />
				</div>
				<div class="col-sm-4"><p class="help-block" id="userNickname_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">真实姓名</label>
				<div class="col-sm-6">
					<input type="text" id="userRealname" name="userRealname" class="form-control" valid="r" validTitle="用户姓名" validInfoArea="userRealname_info_area" />
				</div>
				<div class="col-sm-4"><p class="help-block" id="userRealname_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">性别</label>
				<div class="col-sm-6">
					<div class="radio radio-primary radio-inline">
						<input type="radio" id="userSex-1" name="userSex" valid="r" validTitle="性别" validInfoArea="userSex_info_area" value="1" checked/>
						<label for="userSex-1"> 男 </label>
					</div>
					<div class="radio radio-primary radio-inline">
						<input type="radio" id="userSex-0" name="userSex" valid="r" validTitle="性别" validInfoArea="userSex_info_area" value="0" />
						<label for="userSex-0"> 女 </label>
					</div>
					<div class="radio radio-primary radio-inline">
						<input type="radio" id="userSex-2" name="userSex" valid="r" validTitle="性别" validInfoArea="userSex_info_area" value="2" />
						<label for="userSex-2"> 未知 </label>
					</div>
				</div>
				<div class="col-sm-4"><p class="help-block" id="userSex_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">年龄</label>
				<div class="col-sm-6">
					<input type="text" id="userAge" name="userAge" class="form-control" valid="number" validTitle="用户年龄" validInfoArea="userAge_info_area" />
				</div>
				<div class="col-sm-4"><p class="help-block" id="userAge_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">出生日期</label>
				<div class="col-sm-6">
					<input type="text" id="userBirthday" name="userBirthday" class="form-control" onClick="WdatePicker()" readonly />
				</div>
				<div class="col-sm-4"></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">手机</label>
				<div class="col-sm-6">
					<input type="text" id="userPhone" name="userPhone" class="form-control" valid="mobile" validTitle="用户手机" validInfoArea="userPhone_info_area" />
				</div>
				<div class="col-sm-4"><p class="help-block" id="userPhone_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">邮箱</label>
				<div class="col-sm-6">
					<input type="text" id="userEmail" name="userEmail" class="form-control" valid="email" validTitle="用户邮箱" validInfoArea="userEmail_info_area" />
				</div>
				<div class="col-sm-4"><p class="help-block" id="userEmail_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">锁定</label>
				<div class="col-sm-3">
					<div class="radio radio-primary radio-inline">
						<input type="radio" id="locked-0" name="locked"  value="0" checked/>
						<label for="locked-0"> 否 </label>
					</div>
					<div class="radio radio-primary radio-inline">
						<input type="radio" id="locked-1" name="locked" value="1"/>
						<label for="locked-1"> 是 </label>
					</div>
				</div>
				<label class="col-sm-2 control-label text-right">启用</label>
				<div class="col-sm-3">
					<div class="radio radio-primary radio-inline">
						<input type="radio" id="enabled-1" name="enabled" value="1" checked/>
						<label for="enabled-1"> 是 </label>
					</div>
					<div class="radio radio-primary radio-inline">
						<input type="radio" id="enabled-0" name="enabled" value="0" />
						<label for="enabled-0"> 否 </label>
					</div>
				</div>
			</div>

			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="button" class="save-btn btn btn-primary">
						<i class="fa fa-save"></i> 保存
					</button>
				</div>
			</div>
		</form>
	</div>
	<!-- END 内容部分 -->
	
	<%layout("/WEB-INF/view/common/inc/admin_js.html",{modules:'jquery,bootstrap,dtvalidate,dtvalidate-lang-zh_cn,datepicker'}){}%>
	<script>
	var cvalidator;
	$(function(){
		//初始化验证器
		cvalidator = $.fn.dlshouwen.validator.init($('#info-form'));
		
		//提交表单
		$('.save-btn').on('click',function(){
			if(!cvalidator.validResult()){
				$.fn.dlshouwen.validator.tools.toast('验证失败！', 'error', 2000);
				return;
			}
			
			//数据提交
			$.post('${ctxPath}/power/user/save.do',$('#info-form').serialize(),function(data){
				if( data.ok ){
					parent.layer.msg(data.msg,{icon:1,time:2000,shade: [0.8, '#393D49']}, function(){
						parent.getCurrentActiveIframe().$powerusertable.bootstrapTable('refresh');
						parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭弹窗
					});
				}else{
					parent.layer.msg(data.msg,{icon: 0,time:1500,shade: [0.8, '#393D49']});
				}
			});
		});
    });
    </script>
  </body>
</html>